/**
 * 功能描述
 * 这个页面修改要慎重，因为它还关系到了散客入住登记
 */
define(function (require, exports, module) {
    //引入视图基类
    var ELView = require("elview");
    var HandlerBars = require("handlebars");
    
    //assets
    var template = require("./assets/tpl/roompanorama_main.tpl");
    require("./assets/css/roompanorama_main.css");
    var typeTpl = require("./assets/tpl/roompanorama_type.tpl");

    //component
    var roompanoramaSubnavComp = require("./component/roompanoramaSubnav");

    //handler
    var events = require("./handler/events");
    
    var roompanorama_main = ELView.extend({
        attrs: {
        	model:{
        		flag:"RoomPanorama"
        	},
            template: template
        },
        changeImg:events.changeImg,
        print:events.print,
        events:events.events,
        setData:events.setData,
        renderRoomNumber:events.renderRoomNumber,
        loadRoomType:events.loadRoomType,
        initComponent:function (params, widget) {
        	roompanoramaSubnavComp.initComponent(params, widget);
        	var html = HandlerBars.compile(typeTpl)();
        	$(".J-status").html(html);
        	
        },
        afterInitComponent: function (params, widget) {
        	widget.get("subnav").load("building",{
        		callback:function(data){
        			widget.loadRoomType(widget,data[0].pkOrgBuilding);
            		widget.changeImg("clear","1jingfang_chose.png");
            		widget.setData("Clear",widget);
            	}
        	})
        }
    });

    module.exports = roompanorama_main;
});
